<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        /* slice --从第几位数值开始查询几位数值
           substring
           substr
        */
        var str="hello world";
        console.log(str.slice(0,3))   //startIndex<=num<=endIndex    
        console.log(str.substring(0,3))
        console.log(str.substr(0,4))
    </script>
</body>
</html>